// https://www.npmjs.com/package/eq-mysql
const { table, query} = require('eq-mysql')

let index = async (ctx, next) => {
    ctx.success('index')
    // 错误 ctx.fail('index')
}

let create = async (ctx, next) => {
    const data = ctx.request.body
    ctx.success('create')
}
create.method = 'post'

let show = async (ctx, next) => {
    ctx.success('show')
}

let edit = async (ctx, next) => {
    // 获取post数据
    const data = ctx.request.body
    ctx.response.body = 'edit'
    ctx.success('edit')
}
// 设置post请求
edit.method = 'post'

let destroy = async (ctx, next) => {
    // 获取get数据
    const data = ctx.query;
    ctx.success('destroy')
}

module.exports = {
    // hide为ture时路由不生效
    // hide: true,
    // name可以重命名
    name: 'template',
    index,
    create,
    show,
    edit,
    destroy
}